﻿module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		/*压缩*/
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= pkg.version %> used by <%= pkg.author %> on <%= grunt.template.today("yyyy-mm-dd hh:MM") %> */\n',
				mangle: true
			},
			AppJs: {
				files: [{
					expand: true,
					cwd: "assets/js/",
					src: ["*.js", '!*-min.js'],
					dest: 'assets/min/',
					ext: '.js'
				}]
			}/*,
			AppJs: {
				files: {
					'assets/min/net-pack-min.js': [
						'assets/js/*.js'
					]
				}
			}*/
		},
		/*css 合并并压缩*/
		cssmin: {
			options: {
				banner: '/*! <%= pkg.name %> <%= pkg.version %> used by <%= pkg.author %> on <%= grunt.template.today("yyyy-mm-dd hh:MM") %> */'
			},
			/*appcss: {
				debug: false,
				expand: true,
				cwd: 'assets/css/',
				src: ['*.css', '!*-min.css'],
				dest: 'assets/min/',
				ext: '.css'
			},*/
			appcss: {
				files: {
					'assets/min/style-min.css': [
						'assets/css/*.css'
					]
				}
			}
		}
	});
	grunt.loadNpmTasks('grunt-cmd-transport');
	grunt.loadNpmTasks('grunt-cmd-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-watch');

	/*build AppJs*/
	grunt.registerTask('build.app', ['uglify:AppJs', 'cssmin:appcss']);
};